/**
 * 游戏信息
 * */
package riki.org.com.date
{
	import mx.collections.ArrayCollection;
	import mx.formatters.DateFormatter;
	
	import riki.org.com.model.ModelLocator;
	
	public class OnlineApps
	{
		public	var	isHaveDate		:Boolean		=	false;
		//模块名
		public	var	appName			:String 		= "";
		//游戏全名
		public	var	name			:String 		= "";
		//游戏日志
		public	var	gameLog			:Array	 		= new	Array();
			
		private	var	UserInfoList	:ArrayCollection;
		private	var	RoomInfoList	:ArrayCollection;
		
		[Bindable]
		public	var	LogdataProvider	:ArrayCollection=	new	ArrayCollection();;
		
		private	var	downloads1		:int 			= 0;
		private	var	downloads2		:int 			= 0;
		private	var	plays1			:int 			= 0;
		private	var	plays2			:int 			= 0;
		
		public	function	OnlineApps(_appname:String,_name:String)
		{
			appName	=	_appname;
			name	=	_name
		}
		
		/**
		 * 取得日志字符串
		 * */
		public	function	getLogListDate	():ArrayCollection
		{
			trace(" 取得日志字符串");
			var	sTemp	:String	=	"";
			var	LIndex	:int	=	LogdataProvider.length - 1;
			var	a:DateFormatter	=	new	DateFormatter();
			a.formatString		=	"[YYYY-MM-DD JJ:NN:SS]";
			
			sTemp				=	a.format(new Date())+":"+gameLog[0];
			if(LIndex<0)
			{
				LIndex	=	0;
			}
			if(LogdataProvider.length>50)
			{
				LogdataProvider.removeItemAt(0);
			}
			LogdataProvider.addItemAt({label:sTemp,data:sTemp},LIndex);
			ModelLocator.getInstance().vObj.MainApp.LogList.verticalScrollPosition	=	ModelLocator.getInstance().vObj.MainApp.LogList.maxVerticalScrollPosition;
			return	LogdataProvider;
		}
		
		/**
		 * 当前游戏人数列表数据库
		 * */
		public	function	get	PlayeList	():ArrayCollection
		{
			return	UserInfoList
		}
		
		public	function	set	PlayeList	(arr:ArrayCollection):void
		{
			UserInfoList	=	arr;
		}
		
		/**
		 * 当前房间信息数据库
		 * */
		public	function	get	RoomList	():ArrayCollection
		{
			return	RoomInfoList
		}
		
		public	function	set	RoomList	(arr:ArrayCollection):void
		{
			RoomInfoList	=	arr;
		}
		
		/**
		 * 当前游戏在线总人数
		 * */
		public	function	get	PlayerCount	():int
		{
			return	UserInfoList.length;
		}
		
		/**
		 * 当前游戏开启房间数
		 * */
		public	function	get	RoomCount	():int
		{
			return	RoomInfoList.length;
		}
		
		/**
		 * 当天游戏下载量
		 * */
		public	function	get	DownloadCountOfToday	():int
		{
			//var model:ModelLocator	= ModelLocator.getInstance();
			//var appName:String	=	model.vObj.ServerAppListCom.selectedItem.data;
			//if()
			return	downloads1
		}
		
		/**
		 * 历史游戏下载量
		 * */
		public	function	get	DownloadCountOfHistory	():int
		{
			return	downloads2
		}
		
		/**
		 * 当天使用次数
		 * */
		public	function	get	PlayCountOfToday	():int
		{
			return	plays1
		}
		
		/**
		 * 历史使用次数
		 * */
		public	function	get	PlayCountOfHistory	():int
		{
			return	plays2
		}
		
		
	}
}